package com.fy.market.trigger.http;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.hutool.log.Log;
import com.fy.market.persistent.respository.strategy.StrategyRepository;
import com.fy.market.strategy.model.entity.StrategyAwardRuleEntity;
import com.fy.market.trigger.api.AwardApi;
import com.fy.market.types.common.reslut.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import java.util.List;

import static com.fy.market.types.common.reslut.R.*;

/**
 * 奖品接口
 * @author fwq
 * @date 2025-09-04
 */
@Tag(name = "奖品接口")
@Slf4j
@RestController
@RequestMapping("/award")
public class AwardController implements AwardApi {

    @Resource
    private StrategyRepository strategyRepository;

    /**
     * 获取全部奖品信息
     * @param strategyId 策略ID
     * @return 全部奖品信息
     */

    @Override
    @Operation(summary = "获取全部奖品信息")
    @PostMapping ("/all")
    public R getAllAwards(Integer strategyId) {
        List<StrategyAwardRuleEntity> strategyAwardRuleEntities = strategyRepository.queryStrategyAwardRuleEntities(100001);
        log.info("获取全部奖品信息, strategyId: {}, strategyAwardRuleEntities: {}", strategyId, strategyAwardRuleEntities);
        return ok();
    }
    /**
     * 获取奖品详情
     * @param id 奖品ID
     * @return 奖品详情
     */
    @Override
    @Operation(summary = "获取奖品详情")
    @SaCheckLogin
    @GetMapping("/{id}")
    public R getAwardDetail(@PathVariable Integer id) {
        return custom(300, "未实现", "数据为空!");
    }
}
